<div class="blazorise-codeblock">
<div class="html"><pre>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Button</span> <span class="htmlAttributeName">Color</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Color</span><span class="enumValue">.Primary</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Clicked</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="sharpVariable"><span class="atSign">&#64;</span>SetPageProgress25</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>25 %<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Button</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Button</span> <span class="htmlAttributeName">Color</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Color</span><span class="enumValue">.Primary</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Clicked</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="sharpVariable"><span class="atSign">&#64;</span>SetPageProgress50</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>50 %<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Button</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Button</span> <span class="htmlAttributeName">Color</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Color</span><span class="enumValue">.Primary</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Clicked</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="sharpVariable"><span class="atSign">&#64;</span>SetPageProgress75</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>75 %<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Button</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Button</span> <span class="htmlAttributeName">Color</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Color</span><span class="enumValue">.Primary</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Clicked</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="sharpVariable"><span class="atSign">&#64;</span>SetPageProgress100</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>100 %<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Button</span><span class="htmlTagDelimiter">&gt;</span>

<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Button</span> <span class="htmlAttributeName">Color</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Color</span><span class="enumValue">.Secondary</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Clicked</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="sharpVariable"><span class="atSign">&#64;</span>SetPageProgressIndeterminate</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>Indeterminate<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Button</span><span class="htmlTagDelimiter">&gt;</span>

<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Button</span> <span class="htmlAttributeName">Color</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Color</span><span class="enumValue">.Secondary</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Clicked</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="sharpVariable"><span class="atSign">&#64;</span>SetPageProgressHidden</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>Hide<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Button</span><span class="htmlTagDelimiter">&gt;</span>
</pre></div>
<div class="csharp"><pre>
<span class="atSign">&#64;</span>code{
    [Inject] IPageProgressService PageProgressService { <span class="keyword">get</span>; <span class="keyword">set</span>; }

    Task SetPageProgress25()
    {
        <span class="keyword">return</span> PageProgressService.Go( <span class="number">25</span>, options =&gt; { options.Color = Color.Warning; } );
    }

    Task SetPageProgress50()
    {
        <span class="keyword">return</span> PageProgressService.Go( <span class="number">50</span>, options =&gt; { options.Color = Color.Warning; } );
    }

    Task SetPageProgress75()
    {
        <span class="keyword">return</span> PageProgressService.Go( <span class="number">75</span>, options =&gt; { options.Color = Color.Warning; } );
    }

    Task SetPageProgress100()
    {
        <span class="keyword">return</span> PageProgressService.Go( <span class="number">100</span>, options =&gt; { options.Color = Color.Warning; } );
    }

    Task SetPageProgressIndeterminate()
    {
        <span class="keyword">return</span> PageProgressService.Go( <span class="keyword">null</span>, options =&gt; { options.Color = Color.Warning; } );
    }

    Task SetPageProgressHidden()
    {
        <span class="comment">// setting it to -1 will hide the progress bar</span>
        <span class="keyword">return</span> PageProgressService.Go( -<span class="number">1</span> );
    }
}
</pre></div>
</div>
